{% extends "account/base.html" %}

{% load inventree_extras %}
{% load i18n account socialaccount crispy_forms_tags inventree_extras %}

{% block head_title %}{% trans "Sign In" %}{% endblock head_title %}

{% block content %}

{% settings_value 'LOGIN_ENABLE_REG' as enable_reg %}
{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %}
{% settings_value 'LOGIN_ENABLE_SSO' as enable_sso %}
{% inventree_customize 'login_message' as login_message %}
{% mail_configured as mail_conf %}

<div class='d-flex flex-wrap'>
  <h3>{% trans "Sign In" %}</h3>
  {% include "spacer.html" %}
  {% if enable_reg %}
  <div class='float-right'>
    {% trans "Not a member?" %}&nbsp;
    <a class="btn btn-primary btn-small" href="{{ signup_url }}">
      <span class='fas fa-user-plus'></span>&nbsp;{% trans "Sign Up" %}
    </a>
  </div>
  {% endif %}
</div>

<form class="login" method="post" action="{% url 'account_login' %}">
  {% csrf_token %}
  {{ form|crispy }}
  {% if redirect_field_value %}
  <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
  {% endif %}

  <div class="btn-group" role="group" style='width: 100%;'>
    <button class="btn btn-success" type="submit">
      <span class='fas fa-sign-in-alt'></span> {% trans "Sign In" %}
    </button>
  </div>
  {% if login_message %}
  <div>{{ login_message | safe }}<hr></div>
  {% endif %}
  {% if mail_conf and enable_pwd_forgot %}
  <a href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>
  {% endif %}
</form>

{% if enable_sso %}
<hr>

<div class='sso-header'>
  <em>{% trans "or log in with" %}</em>
</div>

<div>
  {% include "socialaccount/snippets/provider_list.html" with process="login" %}
</div>

{% include "socialaccount/snippets/login_extra.html" %}
{% endif %}

{% endblock content %}
